<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2002 Bharat Mediratta
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
?>
<?php
// Hack prevention.
if (!empty($_REQUEST["GALLERY_BASEDIR"])) {
	print "Security violation\n";
	exit;
}
?>
<?php require("./init.php"); ?>
<?php
if (!$gallery->user->isAdmin()) {
	exit;	
}

if ($submit) {
	if (!strcmp($submit, "Delete")) {
		$gallery->userDB->deleteUserByUsername($uname);
		header("Location: manage_users.php");
	} else if (!strcmp($submit, "Cancel")) {
		header("Location: manage_users.php");
	}
}

?>
<html>
<head>
  <title><?php echo _XG_DELUSER01;?></title>
  <?php echo getStyleSheetLink() ?>
</head>
<body>

<center>
<span class="popuphead"><?php echo _XG_DELUSER01;?></span>
<br>
<br>
<?php echo makeFormIntro("delete_user.php"); ?>
<input type=hidden name=uname value=<?php echo $uname?>>

<?php
if (!strcmp($gallery->user->getUsername(), $uname)) {
	print center(gallery_error("You can't delete your own account!"));
	print "<p>";
} else {
?>
<?php echo _XG_DELUSER02;?> <?php echo _XG_DELUSER03;?> 
<?php echo _XG_DELUSER04;?> <?php echo _XG_DELUSER05;?> 
<?php echo _XG_DELUSER06;?> <b><?php echo $uname?></b>?
<p>
<p>

<input type="submit" name="submit" value="<?php echo _XG_DELETE;?>">
<?php
}
?>

<input type="submit" name="submit" value="<?php echo _XG_CANCEL;?>">
</form>

</body>
</html>
